$(function(){ 

//评论
    var spanList = $(".doctor-evaluate span");
    var li_List = $(".doctor-evaluate ul li");
    for(var i = 0; i < spanList.length; i++) {
        spanList[i].index = i;
        spanList[i].onclick = function() {
            for(var j = 0; j < spanList.length;j++) {
                spanList[j].className = "";
                li_List[j].className = "";
            }
            this.className = "span-active";
            li_List[this.index].className = "li-active";
        }
    }

	//点击擅长
	$(".evaluate-doctorClick .one span").onclick(function(){
		$(this).toggleClass("active");
	});

	//提交评论
    $("#evaBtn").on("click", submitEvaluateInfo);
    /**
     * 提交评价信息
     */
    function DoctorEvaluate() {
        var doctorEvaluate;
        doctorEvaluate = utilModule.dealFormFilter("evalForm");
        return doctorEvaluate;
    }
    function submitEvaluateInfo() {
        var doctorid = utilModule.getQueryString("doctorid") == undefined ? 75 : utilModule.getQueryString("doctorid");
        var serviceid = utilModule.getQueryString("serviceid") == null ? 75 : utilModule.getQueryString("serviceid");
        var _score=$(".span-active").attr("v");
        var content = $("#content").val();
       
        if(utilModule.checkUndefined(doctorid) == "") {
            mui.alert("医生id不能为空", "提示");
            return false;
        }
        if(utilModule.checkUndefined(serviceid) == "") {
            mui.alert("咨询单id不能为空", "提示");
            return false;
        }
        if(utilModule.checkUndefined(content) == "") {
            mui.alert("评价内容不能为空", "提示");
            return false;
        }
      
        var doctorEvaluate = DoctorEvaluate();
        doctorEvaluate.appraiserid = USERID;
        doctorEvaluate.doctorid = doctorid;
        doctorEvaluate.serviceid = serviceid;
        doctorEvaluate.score=_score;

        doctorModule.doctorEvaluate(doctorEvaluate, function(callBack) {
        	location.href="../doctor/doctor-details.html?doctorid="+doctorid;
       
        });
    }
});